<?php 
/**
 * apc驱动
 * @author Yuwei(yuwei1122@gmail.com)
 *
 */
final class BluePhp_Library_Cache_Drives_Apc
{
	/**
	 * 构造函数
	 */
	public function __construct()
	{
		extension_loaded('apc') or die('apc extention is not loaded');
	}
	
	/**
	 * get
	 * @param unknown_type $key
	 */
	public function get($key)
	{
		return apc_fetch($key);
	}
	
	/**
	 * set
	 * @param unknown_type $key
	 * @param unknown_type $value
	 * @param unknown_type $time
	 */
	public function set($key,$value,$time)
	{
		return apc_store($key, $value, $time);
	}
	
	/**
	 * delete
	 * @param unknown_type $key
	 */
	public function delete($key)
	{
		return apc_delete($key);
	}
	
	/**
	 * replace
	 * @param unknown_type $key
	 * @param unknown_type $value
	 */
	public function replace($key,$value)
	{
		return apc_store($key, $value, CACHE_LIFETIME);
	}
	
	/**
	 * flush
	 */
	public function flush()
	{
		return apc_clear_cache('user'); //清除用户缓存  
	}
}
?>